<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.sfilyh.util.DBUtil,java.util.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%
 	// new article
 	String articleSql = "select id,title from tb_article where status = 0 order by createtime desc limit 0,10";
    request.setAttribute("recentArticle", DBUtil.queryForListMap(articleSql));
    // new post
    String postSql = "select A.guestname,A.content,B.id,B.title  from tb_post A , tb_article B where A.articleid = B.id order by A.createtime desc limit 0,10";
    request.setAttribute("recentPost", DBUtil.queryForListMap(postSql));    
 %>
<div class="span3">
          <div class="well sidebar-nav">
               <ul class="nav nav-list">
                     <li class="nav-header">最新文章</li>
                     <c:forEach var="item" items="${recentArticle}">
                     <li><a href="<%=request.getContextPath()%>/view?id=${item.id}">${item.title}</a></li>                
                	 </c:forEach>
				</ul>
         </div>
         
         <div class="well sidebar-nav">
                <ul class="nav nav-list">
                     <li class="nav-header">最新评论</li>
				</ul>
               <ul class="ds-recent-comments nav nav-list" data-show-avatars="0" data-num-items="5">
               </ul>					
         </div>
     </div>   